package com.delianna.bwt.models;

import com.delianna.bwt.R;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author Delio Castillo (jangeador@gmail.com)
 *
 */
public class Lane implements Parcelable {

	private String lane_class;
	private String lane_type;
	private String update_time;
	private String operational_status;
	private String delay_minutes;
	private String lanes_open;

	public String getLaneClass() {
		return lane_class;
	}

	public void setLaneClass(String value) {
		lane_class = value;
	}

	public String getLaneType() {
		return lane_type;
	}

	public void setLaneType(String value) {
		lane_type = value;
	}

	public String getUpdateTime() {
		return this.update_time;
	}

	public void setUpdateTime(String value) {
		this.update_time = value;
	}

	public String getOperationalStatus() {
		return this.operational_status;
	}

	public void setOperationalStatus(String value) {
		this.operational_status = value;
	}

	public String getDelayMinutes() {
		return delay_minutes;
	}

	public void setDelayMinutes(String value) {
		delay_minutes = value;
	}

	public String getLanesOpen() {
		return lanes_open;
	}

	public void setLanesOpen(String value) {
		lanes_open = value;
	}

	public String getTitle() {
		StringBuilder sb = new StringBuilder();
		sb.append(this.lane_class + " " + this.lane_type);
		return sb.toString();
	}

	public String getSubtitle() {
		StringBuilder sb = new StringBuilder();
		if (update_time != null && update_time.indexOf("At") > 0)
			sb.append(update_time + " ");
		if (operational_status != null)
			sb.append(operational_status + " ");
		if (delay_minutes != null)
			sb.append(delay_minutes + " ");
		if (lanes_open != null)
			sb.append(lanes_open + " lanes open.");
		return sb.toString();
	}

	public Lane() {
	}

	public Lane(Parcel in) {
		readFromParcel(in);
	}

	private void readFromParcel(Parcel in) {
		// TODO Auto-generated method stub
		this.lane_class = in.readString();
		this.lane_type = in.readString();
		this.update_time = in.readString();
		this.operational_status = in.readString();
		this.delay_minutes = in.readString();
		this.lanes_open = in.readString();

	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		// TODO Auto-generated method stub
		out.writeString(lane_class);
		out.writeString(lane_type);
		out.writeString(update_time);
		out.writeString(operational_status);
		out.writeString(delay_minutes);
		out.writeString(lanes_open);
	}

	public static final Parcelable.Creator<Lane> CREATOR = new Parcelable.Creator<Lane>() {
		public Lane createFromParcel(Parcel in) {
			return new Lane(in);
		}

		public Lane[] newArray(int size) {
			return new Lane[size];
		}
	};

}
